<%@page contentType="text/html;charset=UTF-8"%>
<%@page pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Video Image</title>
</head>
<script language="JavaScript">
	function trim(stringToTrim) {
		return stringToTrim.replace(/^\s+|\s+$/g,"");
	}
	function ltrim(stringToTrim) {
		return stringToTrim.replace(/^\s+/,"");
	}
	function rtrim(stringToTrim) {
		return stringToTrim.replace(/\s+$/,"");
	}
				function Validate()
				  { 
					 var file=document.getElementById("txtfile").value;
					 if(trim(file)==""){
						 alert("Please choose file to upload");
						 return false;
					 }
					 return true;
				 }	
				
</script>
<body>
<center>
<form:form modelAttribute="uploadItem" name="frm" method="post" enctype="multipart/form-data" onsubmit="return Validate();">
	<table border="0" cellpadding="0" cellspacing="0" width="70%" class="newsTitle">
		<tr><td colspan="3" height="10"> </td></tr>	
		<tr align="center"><td colspan="3" height="30" style="font-size:14px;"><u>រូបភាព</u></td></tr>
		<tr><td colspan="3" height="10"> <input type="hidden" name="txtcourseid" id="txtcourseid" value="${video[0].COURSE_ID}" ></td></tr>
		<tr><td colspan="3" align="center" height="10"><c:out value="${video[0].FILE_TITLE}"></c:out></td></tr>
		<tr><td colspan="3" height="10"> </td></tr>
		<tr>
			<td align="right" colspan="3">
			Choose File :&nbsp;<form:input path="fileData" id="txtfile" type="file" /><input type="submit" value="Upload" class="input_button" >
			</td>
		</tr>
		<tr><td colspan="3">&nbsp;</td></tr>
		<c:if test="${fn:length(video)>0}">
			<c:forEach var="x" begin="0" end="${fn:length(video)-1}" step="1" varStatus ="status">
						<tr align="center">
							<td align="center" colspan="3"><img src="${video[x].FILE_PATH}Videos/Images/${video[x].IMAGE_FILE}"></td>
						</tr>
			</c:forEach>
		</c:if>
		<tr><td colspan="3">&nbsp;</td></tr>
		<tr>
			<td colspan="3" align="center">
				<input type="button" class="input_button" onclick='window.location="course_list.html"' value="ចាកចេញ">
			</td>
		</tr>
	</table>
</form:form>	
</center>

</body>
<script type="text/javascript">
	function SaveNews(id){
		window.location="save_images.html?nid="+id;
	}
</script>
</html>